﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Data
{
    public class SqlLogic : SqlClause
    {
        public SqlClause Left { get; set; }
        public string Logic { get; set; }
        public SqlClause Right { get; set; }

        public override string ToSql()
        {
            if (Left != null && Right != null)
                return string.Format("({0}) {1} ({2})", Left.ToSql(), Logic, Right.ToSql());
            else
            {
                if (Left != null)
                    return Left.ToSql();
                if (Right != null)
                    return Right.ToSql();
            }
            return string.Empty;
        }
    }
}
